#pragma once 

#include <alibabacloud/oss/OssClient.h>
#include "NoCopy.h"

using namespace AlibabaCloud::OSS;

struct OssConfig
{
    std::string EndPoint;
    std::string Region;
    std::string BucketName;
    std::string OriginPath;
};

class OssManage
: public NoCopy
{
public:
    static std::shared_ptr<OssManage> getInstance()
    {
        if(!m_oss)
        {
            // auto i = new OssManage;
            // m_oss.reset(i);
            m_oss = std::shared_ptr<OssManage>(new OssManage{});
        }
        return m_oss;
    }

    void InitOssClient(std::string &EndPoint, std::string &Region, std::string &BucketName, std::string &OriginPath);

    int OssSimpleUpload(std::string &userName, std::string &fileName, std::string &&content);

    int OssSimpleUploadLocal(const std::string &path);

    ~OssManage();  
private:
    OssManage();

    OssConfig m_oconf;

    std::shared_ptr<OssClient> m_client = nullptr;

    static std::shared_ptr<OssManage> m_oss;
};